home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 April
/
EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso
/
EARCD
/
comm
/
tcp
/
ChatBox1_153.lha
/
ChatBox
/
Rexx
/
aminetfind4.cb
< prev
next >
Wrap
Text File
|
1996-04-20
|
3KB
|
96 lines
/* AminetFind Arexx script for ChatBox
Written by Josef Faulkner (panther@gate.net) IRC: Josef
This script will connect to an ADT search port on an Aminet findserver
and use the port to do a very fast search of the complete aminet index
for some keywords.
*/
if ~show('L','rexxsupport.library') then if ~addlib('rexxsupport.library',0,-30,0) then exit 20
indexfile='dh2:net/index'
parse arg chan' 'keywords
length=10 /* Default number of max hits */
absmax=20 /* Absolute maximum hits to show */
width=80 /* Default maximum width of result text */
output='/echo'
do while left(keywords,1)='-'
opt=word(keywords,1)
opt=upper(right(opt,length(opt)-1))
select
when opt='SAY' then do
output='/m' chan
CMD '/echo Saying results to channel.'
end
when opt='MAX' then do
if datatype(word(keywords,2),n) then do
length=word(keywords,2)
end
else do
CMD '/echo 'word(keywords,2)' needs to be a numerical option'
end
parse var keywords .' 'keywords
end
when opt='TO' then do
output='/m' word(keywords,2)
parse var keywords .' 'keywords
end
otherwise do
CMD '/echo Unrecognized Option: 'word(keywords,1)
end
end
parse var keywords .' 'keywords
end
if keywords='' then do
CMD '/echo Usage: /find [-opts] keywords'
CMD '/echo Opts:'
CMD '/echo -SAY Says to current channel'
CMD '/echo -MAX <hits> Limits hits to <hits>'
CMD '/echo -TO <whom> Sends results to <whom>'
exit
end
if ~showlist(H,'TCP') then address command 'mount TCP: from amitcp:devs/inet-mountlist'
if ~showlist(H,'TCP') then address command 'mount TCP:'
if showlist(H,'TCP') then do
if open(1,'TCP:find.germany.aminet.org/1848',w) then do
call writeln(1,'find 'keywords)
call writeln(1,'quit')
linecnt=0
do until eof(1)
text=left(readln(1),width)
linecnt=linecnt+1
if linecnt<=length then do
if (text~='') then do
if left(text,3)='***' then linecnt=linecnt-1
if linecnt=1 then do
CMD output 'Searching for keywords: 'keywords', maxhits: 'length
CMD output 'File Dir Size Description'
end
if left(text,3)='***' then CMD '/echo' text
else CMD output text
if output~='/echo' then do
if linecnt//5=0 then call delay(250)
if linecnt>=absmax then do
CMD '/echo Absolute maximum hits reached (Flood Protection) Ending search.'
exit
end
end
end
else linecnt=linecnt-1
end
end
if linecnt=1 then CMD output linecnt' match found.'
else CMD output linecnt' matches found.'
end
else CMD '/echo Could not open connection.'
end
else CMD '/echo Could not mount TCP:'